package tests;

import common.Utils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;

public class DetailPage extends Utils {
    public static String url = "http://124.223.114.169:8080/blog_detail.html?blogId=24";
    public DetailPage(String url) {
        super(url);
    }


    public void detail(){
        //编辑
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(1)")).click();

        driver.findElement(By.cssSelector("body > div.nav > a:nth-child(5)")).click();
        String writetitle = driver.getTitle();
        assert writetitle.equals("博客编辑页 ");


        //删除
        driver.navigate().back();
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(2)")).click();
        Alert alert = driver.switchTo().alert();
        alert.dismiss();//不删


        //返回列表页
        //body > div.nav > a:nth-child(4)
        driver.findElement(By.cssSelector("body > div.nav > a:nth-child(4)")).click();
        String list = driver.getTitle();
        assert list.equals("博客列表页");



    }
}
